xgboost_recp = recipe(diagnosis~.,data = train_data) |>
  step_range(INR,Cr,bleeding,time) |>
  step_smotenc(diagnosis,over_ratio=0.5 ,neighbors=1,seed=123)

xgboost_spec = boost_tree() |>
  set_engine("xgboost") |>
  set_mode("classification")

xgboost_flow = workflow() |>
  add_recipe(xgboost_recp) |>
  add_model(xgboost_spec)

xgboost_fit = fit(xgboost_flow,data = train_data)
xgboost_predict = augment(xgboost_fit,new_data=test_data)

xgboost_auc = roc_auc(data = xgboost_predict,truth = diagnosis,.pred_1,event_level="second")
xgboost_acc = accuracy(data = xgboost_predict,truth = diagnosis,.pred_class)
xgboost_sens = sensitivity(data=xgboost_predict,truth = diagnosis,.pred_class,event_level = "second")
xgboost_spec = specificity(data=xgboost_predict,truth = diagnosis,.pred_class,event_level = "second")
xgboost_ppv = ppv(data=xgboost_predict,truth = diagnosis,.pred_class,event_level = "second")
xgboost_conf_mat = conf_mat(data=xgboost_predict,truth = diagnosis,.pred_class)
xgboost_f_meas = f_meas(data=xgboost_predict,truth = diagnosis,.pred_class,event_level = 'second')

# xgboost_evaluation_table <- tibble(
#   metric = c("auc", "acc","sens","spec","ppv"),
#   value = c(auc$.estimate, acc$.estimate,sens$.estimate,spec$.estimate,ppv$.estimate)
# )
# 
# xgboost_evaluation_table

# conf_mat